import {IAdminState} from "../state/adminState";
import {IAdminAction} from "../action/adminAction";
import {AdminType} from "../type/adminType";

const initAdminState : IAdminState = {
    loading : true,
    admin :{
        name :''
    }
}

const admin = (state: IAdminState = initAdminState,action :IAdminAction) :IAdminState =>{
    switch (action.type) {
        case AdminType.LOADING:
            return {...state,...action.data}
        case AdminType.LOGIN:
            return {...state,...action.data}
        default:
            return state
    }
}

export default admin
